package com.fmdj.bff.driver.feign;


import com.fmdj.bff.driver.config.MultipartSupportConfig;
import com.fmdj.bff.driver.controller.form.CalculateOrderMileageForm;
import com.fmdj.bff.driver.controller.form.InsertOrderGpsForm;
import com.fmdj.bff.driver.controller.form.InsertOrderMonitoringForm;
import com.fmdj.bff.driver.entity.InsertOrderGpsVo;
import com.fmdj.common.util.CommonResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.multipart.MultipartFile;

import javax.validation.Valid;
import java.util.ArrayList;

//上传文件的远程调用接口中需要额外加两个注解 configuration = MultipartSupportConfig.class 以及 consumes = MediaType.MULTIPART_FORM_DATA_VALUE
@FeignClient(value = "fmdj-nebula",configuration = MultipartSupportConfig.class)
public interface NebulaServiceApi {

    @PostMapping(value = "/monitoring/uploadRecordFile",consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
    CommonResult uploadRecordFile(
            @RequestPart("file") MultipartFile file,
            @RequestPart("name") String name,
            @RequestPart("text ") String text);

    @PostMapping("/monitoring/insertOrderMonitoring")
    CommonResult insertOrderMonitoring(@RequestBody @Valid InsertOrderMonitoringForm form);

    @RequestMapping("/order/gps/insertOrderGps")
    CommonResult insertOrderGps(@RequestBody @Valid InsertOrderGpsForm form );

    @PostMapping("/order/gps/calculateOrderMileage")
    CommonResult calculateOrderMileage(@RequestBody @Valid CalculateOrderMileageForm form);
}
